package com.chenl.provider.题目;

import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.ServerSocket;
import java.net.Socket;

public interface a {
    public static void main(String[] args) throws Exception{
        ServerSocket ss  = new ServerSocket(9977);
        //侦听并接受到此套接字的连接，返回一个socket对象
        Socket s = ss.accept();
        //获取到输入流
        InputStream is = s.getInputStream();
        BufferedReader br = new BufferedReader(new InputStreamReader(is));
        //接收收到的数据
        byte[] buf = new byte[1024];
        int line = 0;
        while((line=is.read(buf))!=-1){
            //将接收到的数据在控制台输出
            System.out.println(new String(buf,0,line));
        }


    }


}
